﻿package  
{
	
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	
	
	public class TeamUI extends MovieClip 
	{
		public var creatureArray:Array = null;
		
		public var px:int = 128;
		public var py:int = 229;
		
		public function TeamUI() 
		{
			// constructor code
			
			creatureArray = new Array();
			
			creatureArray.push( c0 );
			creatureArray.push( c1 );c1.mpText.visible = false;
			creatureArray.push( c2 );c2.mpText.visible = false;
			creatureArray.push( c3 );c3.mpText.visible = false;
			creatureArray.push( c4 );c4.mpText.visible = false;
			creatureArray.push( c5 );c5.mpText.visible = false;
			creatureArray.push( c6 );
			creatureArray.push( c7 );
			creatureArray.push( c8 );
			creatureArray.push( c9 );
			
			returnButton.addEventListener( MouseEvent.CLICK , onClose );
		}
		
		private function onClose( e:MouseEvent ):void
		{
			this.visible = false;
		}
		
		public function clear():void
		{
			for ( var i:int = 0 ; i < creatureArray.length ; i++ )
			{
				creatureArray[ i ].clear();
				creatureArray[ i ].visible = false;
			}
		}
		
		public function setText( n:String , hp:int , maxHp:int , mp:int ):void
		{
			creatureArray[ 0 ].visible = true;
			creatureArray[ 0 ].setText( n , hp , maxHp , mp );
		}
		
		public function setPet( i:int , n:String , hp:int , maxHp:int , mp:int ):void
		{
			creatureArray[ i + 1 ].visible = true;
			creatureArray[ i + 1 ].setText( n , hp , maxHp , mp );
		}
		
		public function setPlayer( i:int , n:String , hp:int , maxHp:int , mp:int ):void
		{
			creatureArray[ i + 6 ].visible = true;
			creatureArray[ i + 6 ].setText( n , hp , maxHp , mp );
		}
		
		
	}
	
}
